<script type="text/javascript">
	function doSearchRoomZone(value) {
		
	}
	
	//表格查询  
	function reloadRoomZone() {
		var params = roomZone_list.datagrid('options').queryParams; //先取得 datagrid 的查询参数  
		printLog(params);
		roomZone_list.datagrid('reload'); //设置好查询参数 reload 一下就可以了  
		roomZone_list.datagrid('unselectAll');
		roomZone_list.datagrid('uncheckAll');
	}


	function addRoomZone() {
		createFromWindow("新增信息", "roomZone.do?editRoomZone", "roomZone.do?saveRoomZone",
				function(data) {
					reloadRoomZone();
				});
	}
	
	function deleteRoomZone() {
		var rows = roomZone_list.datagrid('getChecked');
	    if (rows&&rows.length>0){
	        $.messager.confirm('询问','你确认要删除吗?',function(r){
	            if (r){
	            	var ids = "";
	            	for(var i=0; i<rows.length; i++){
	            		ids += rows[i].id+",";
	            	}
	                $.post('roomZone.do?deleteRoomZoneItems',{ids:ids},function(result){
	                    if (result.success){
	                    	reloadRoomZone();    
	                    }
	                    showMsg(result.msg);
	                },'json');
	            }
	        });
	    }else {
	    	showMsg("请选择操作记录.");
	    }
	}

	function editRoomZone() {
		var rows = roomZone_list.datagrid('getChecked');
		printLog(rows);
		if (rows&&rows.length>0) {
			if(rows.length>1) {
				showMsg('请选择一条操作记录.');
				return;
			}
			createFromWindow("编辑信息", "roomZone.do?editRoomZone&roomZoneId=" + rows[0].id,
					"roomZone.do?saveRoomZone", function(data) {
						reloadRoomZone();
					},true);
		} else {
			showMsg('请选择操作记录.');
		}

	}
	
	
	//操作按钮触发
	function operationsLookRoomZone(id) {
		if (id == undefined) {//点击右键菜单才会触发这个
			var rows = roomZone_list.datagrid('getSelections');
			id = rows[0].id;
		}
		if (id) {
			createFromWindow("查看信息", "roomZone.do?editRoomZone&roomZoneId=" + id,
					null, null,false);
		} else {
			showMsg('请选择查看记录.');
		}
	}
	
	function operationsEditRoomZone(id) {
		if (id == undefined) {//点击右键菜单才会触发这个
			var rows = roomZone_list.datagrid('getSelections');
			id = rows[0].id;
		}
		if (id) {
			createFromWindow("编辑信息", "roomZone.do?editRoomZone&roomZoneId=" + id,
					"roomZone.do?saveRoomZone", function(data) {
						reloadRoomZone();
					},true);
		} else {
			showMsg('请选择编辑记录.');
		}
	}
	
	function operationsSendRoomZone() {
		printLog('发送');
	}
	
	function operationsDeleteRoomZone(id) {
		if (id == undefined) {//点击右键菜单才会触发这个
			var rows = new_list.datagrid('getSelections');
			id = rows[0].id;
		}
		if (id) {
			$.messager.confirm('询问', '你确认要删除吗?', function(r) {
				if (r) {
					$.post('roomZone.do?deleteRoomZoneItems', {
						ids : id
					}, function(result) {
						if (result.success) {
							reloadRoomZone(); 
						}
						showMsg(result.msg);
					}, 'json');
				}
			});
		} else {
			showMsg("请选择操作记录.");
		}
	}
	
	function clearRoomZoneSearch() {
		setGridSearchParams('roomZone_list','roomZoneSearchForm',true,reloadRoomZone);
	}
	
	//根据条件查询
	function roomZoneSearch() {
		setGridSearchParams('roomZone_list','roomZoneSearchForm',false,reloadRoomZone);
	}
</script>


<div class="easyui-layout" data-options="fit:true">
	<div data-options="region:'center',border:false">
		
		<@eu.datagrid id="roomZone_list" toolbar="#roomZonelist_search" idField="id" operations="${operations!}"
			 url="roomZone.do?loadList" rownumbers="true"
			 item="com.xdtech.sh.vo.RoomZoneItem"/>
		
		<div id="roomZonelist_search">
			<div style="margin-bottom:5px;padding-left:5px;margin-top: 5px;">
				<form id="roomZoneSearchForm">
					<table>
						<tr>
<!-- 							<td>房间：</td> -->
<!-- 							<td> -->
<!-- 								<@eu.comboBox url="house.do?loadHouseInfoCombox" name="houseId" width="300"/> -->
<!-- 							</td> -->
							<td>所属项目：</td>
							<td>
							<@eu.comboBox url="shProject.do?loadProjectCombox&key=PROJECT_TYPE" name="projectId" onSelect="linkActionByProCombox('zoneBuildId','zoneUnitId','zoneHouseId',null,value)"/>
							</td>
							<td class="tbLabel">所属楼栋:</td>
							<td>
								<@eu.comboBox id="zoneBuildId" url="building.do?loadBuildingCombox" name="buildingId" onSelect="linkActionByBuildCombox('zoneUnitId','zoneHouseId',null,value)"/>
							</td>
							<td class="tbLabel">所属单元:</td>
							<td>
								<@eu.comboBox id="zoneUnitId" url="unit.do?loadUnitCombox" name="unitId" onSelect="linkActionByUnitCombox('zoneHouseId',null,value)"/>
							</td>
							<td class="tbLabel">所属房屋:</td>
							<td>
								<@eu.comboBox id="zoneHouseId" url="house.do?loadHouseCombox" name="houseId" />
							</td>
							
						</tr>
						<tr>
							<td>区域名称：</td>
							<td><input class="easyui-validatebox textbox" name="name" /></td>
							<td colspan="4">
								<@eu.linkbutton showName="查询" iconCls="icon-search" onclick="roomZoneSearch()"/>
	 					 		<@eu.linkbutton showName="清空" iconCls="icon-clear" onclick="clearRoomZoneSearch()"/>
 					 		</td>
						</tr>
					</table>
				</form>
				
			</div>
			<div id="roomZone_toolbar" style="height: auto">
				<@eu.linkbutton showName="新增" shiro="sh:roomZone:add" iconCls="icon-add" onclick="addRoomZone()"/>
				<@eu.linkbutton showName="删除" shiro="sh:roomZone:delete" iconCls="icon-remove" onclick="deleteRoomZone()"/>
				<@eu.linkbutton showName="编辑" shiro="sh:roomZone:edit" iconCls="icon-edit" onclick="editRoomZone()"/>
				<@eu.linkbutton showName="刷新" shiro="sh:roomZone:refresh" iconCls="icon-reload" onclick="reloadRoomZone()"/>
				
			</div>
		</div>
	</div>
</div>